package com.youkeyi.ddy.cloud.common.api.application.business.crm.order;

import com.youkeyi.ddy.cloud.common.api.application.business.crm.order.dto.BusinessCustomerOrderDetailCloudDto;
import com.youkeyi.ddy.cloud.common.api.application.business.crm.order.dto.BusinessCustomerOrderListCloudDto;
import com.youkeyi.ddy.cloud.common.api.application.business.crm.order.param.*;
import com.youkeyi.ddy.cloud.common.api.application.system.user.dto.SystemUserDetailCloudDto;
import com.youkeyi.ddy.cloud.common.response.ResponseContent;
import io.swagger.annotations.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
 * 系统客户订单
 *
 * @author  liuxiawang
 * @Date 5/24/22 10:36 PM
 * @Location shenzhen.china
 */
@Api(tags = {"【BUSINESS】order management"})
@RestController
@FeignClient(value = "YOUKEYI-DDY-CLOUD-APPLICATION-BUSINESS", fallback = BusinessCustomerOrderCloudServiceFallback.class)
@RequestMapping("/business/customer/order")
public interface BusinessCustomerOrderCloudService {

    // 查询客户订单列表
    @ApiOperation(value = "Query Business CustomerOrder List", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.order.BusinessCustomerOrderCloudService.list")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = BusinessCustomerOrderListCloudDto.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "query", value = "Param of Query Business CustomerOrder List", dataType = "BusinessCustomerOrderListCloudParam", dataTypeClass = BusinessCustomerOrderListCloudParam.class),
    })
    @GetMapping
    public abstract BusinessCustomerOrderListCloudDto list(BusinessCustomerOrderListCloudParam param);

    // 导出客户订单列表
    @ApiOperation(value = "Export Business Customer Order XLS", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.order.BusinessCustomerOrderCloudService.exportXls")})
    @ApiResponse(code = 200, message = "data Property in Response Body")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "query", value = "Param of Export Business Customer Order XLS", dataType = "BusinessCustomerOrderListCloudParam", dataTypeClass = BusinessCustomerOrderListCloudParam.class),
    })
    @GetMapping("/export")
    public abstract void exportXls(HttpServletResponse response, BusinessCustomerOrderListCloudParam param);

    // 查询客户订单详情
    @ApiOperation(value = "Query Business CustomerOrder Detail", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.order.BusinessCustomerOrderCloudService.detail")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = SystemUserDetailCloudDto.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "customerOrderPrimaryKey", paramType = "path", value = "Param of Query Business CustomerOrder Detail", dataType = "String", dataTypeClass = String.class),
    })
    @GetMapping("/{customerOrderPrimaryKey}")
    public abstract BusinessCustomerOrderDetailCloudDto detail(@PathVariable("customerOrderPrimaryKey") String customerOrderPrimaryKey);

    // 创建客户订单
    @ApiOperation(value = "Create Business CustomerOrder", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.order.BusinessCustomerOrderCloudService.create")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "body", value = "Param of Create Business CustomerOrder", dataType = "BusinessCustomerOrderCreateCloudParam", dataTypeClass = BusinessCustomerOrderCreateCloudParam.class),
    })
    @PostMapping("/create")
    public abstract ResponseContent create(@RequestBody BusinessCustomerOrderCreateCloudParam param);


    // 编辑客户订单
    @ApiOperation(value = "Update Business CustomerOrder", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.order.BusinessCustomerOrderCloudService.update")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "body", value = "Param of Update Business CustomerOrder", dataType = "BusinessCustomerOrderUpdateCloudParam", dataTypeClass = BusinessCustomerOrderUpdateCloudParam.class),
    })
    @PatchMapping("update")
    public abstract ResponseContent update(@RequestBody BusinessCustomerOrderUpdateCloudParam param);


    // 删除客户订单
    @ApiOperation(value = "Delete Business CustomerOrder", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.business.crm.order.BusinessCustomerOrderCloudService.delete")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "query", value = "Param of Delete Business CustomerOrder", dataType = "BusinessCustomerOrderDeleteCloudParam", dataTypeClass = BusinessCustomerOrderDeleteCloudParam.class),
    })
    @DeleteMapping("/delete")
    public abstract ResponseContent delete(BusinessCustomerOrderDeleteCloudParam param);

}
